package com.mju.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mju.pojo.District;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DistrictDao extends BaseMapper<District> {
    /**
     * 根据parent获取省或市或区的列表
     * @param parent
     * @return
     */
    @Select("select * from t_dict_district where parent=#{parent}")
    List<District> selectByParent(String parent);

    /**
     * 根据code获取省市区的名称
     */
    @Select("select name from t_dict_district where code=#{code}")
    String selectByCode(String code);
}
